/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.jfonia.model;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * Groups the staff objects (ex. chord staff and lyric staff)
 * Notifies its observes when a staff is added or removed
 * 
 * @author Rik Bauwens
 */
public class StaffCollection extends ListObservable<Staff> implements Iterable<Staff>
{
        private int staffCollectionId;
        private List<Staff> staffs;

        public StaffCollection()
        {
                this(0);
        }

        public StaffCollection(int staffCollectionId)
        {
                this.staffCollectionId = staffCollectionId;
                this.staffs = new ArrayList<Staff>();
        }

        public int getStaffCollectionId()
        {
                return staffCollectionId;
        }

        public void addStaff(Staff staff)
        {
                staffs.add(staff);                
                itemAdded(staff);
        }

        public void removeStaff(Staff staff)
        {
                staffs.remove(staff);
                itemRemoved(staff);
        }

        public Iterator<Staff> iterator()
        {
                return staffs.iterator();
        }
}
